package com.atkxp.service;

import com.atkxp.dao.CommentMapper;
import com.atkxp.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author user
 * @declaration
 * @create 2022/11/18-16:56
 */
@Service
public class CommentServiceImpl implements CommentService{

    @Autowired
    private CommentMapper commentMapper;
    @Override
    public int writeComment(Comment comment) {
        return commentMapper.writeComment(comment);
    }

    @Override
    public int deleteCommentById(int id) {
        return commentMapper.deleteCommentById(id);
    }

    @Override
    public List<Comment> showAllCommentByBlogId(int blogId) {
        return commentMapper.showAllCommentByBlogId(blogId);
    }

    @Override
    public List<Comment> showAllCommentByUserName(int userName) {
        return commentMapper.showAllCommentByUserName(userName);
    }

    @Override
    public int addLike(int id) {
        return commentMapper.addLike(id);
    }

    @Override
    public int getCommentNum(int blogId) {
        return commentMapper.getCommentNum(blogId);
    }

    @Override
    public int deleteLike(int id) {
        return commentMapper.deleteLike(id);
    }

    @Override
    public List<Comment> showAllCommentByBlogIdOrderByLike(int blogId) {
        return commentMapper.showAllCommentByBlogIdOrderByLike(blogId);
    }
}
